/*package com.nasarius.bank.scorecard.util;

import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

import com.nasarius.bank.vo.BankScoreCardVO;
import com.nasarius.bank.vo.FactorScoreCardVO;
import com.nasarius.bank.vo.SearchVO;
import com.nasarius.bankscorecard.bankreport.BankReportType;
import com.nasarius.bankscorecard.bankreport.BankType;
import com.nasarius.bankscorecard.bankreport.FactorType;
import com.nasarius.bankscorecard.bankreport.ObjectFactory;
import com.nasarius.bankscorecard.bankreport.PeroidType;
public class XMLUtil {
	public static String serializeReportXml(List<FactorScoreCardVO> factorScoreCardVOs,SearchVO searchVO){
		
		BankReportType bankReportType = new BankReportType();
		BankReportType.Peroids prd= new BankReportType.Peroids();
		prd.getPeroid().addAll(getPeriodList(factorScoreCardVOs,searchVO));
		bankReportType.setPeroids(prd);
		JAXBContext jaxbContext;
		StringWriter sr= new StringWriter();
		try {
			JAXBElement<BankReportType> j=new ObjectFactory().createBankReport(bankReportType);
			jaxbContext = JAXBContext.newInstance("com.nasarius.bankscorecard.bankreport");
			Marshaller marshaller = jaxbContext.createMarshaller();
			marshaller.setProperty("jaxb.formatted.output",new Boolean(true)); 
			marshaller.marshal(j, sr);
		} catch (JAXBException e) {
			e.printStackTrace();
		}
		
		return sr.toString();
	}
	
	private static List<PeroidType> getPeriodList(List<FactorScoreCardVO> factorScoreCardVOs,SearchVO searchVO){
		
		List<PeroidType> pList= new ArrayList<PeroidType>();
		PeroidType p=new PeroidType();
		p.withEndDate(new SimpleDateFormat("dd/MM/yyyy").format(searchVO.getToDt())).
		withStartDate(new SimpleDateFormat("dd/MM/yyyy").format(searchVO.getFromDt()));
		PeroidType.Factors ftrs= new PeroidType.Factors();
		ftrs.getFactor().addAll(getFactorList(factorScoreCardVOs));
		p.setFactors(ftrs);
		pList.add(p);
		
		return pList;
	}
	
	private static List<FactorType> getFactorList(List<FactorScoreCardVO> factorScoreCardVOs){
		List<FactorType> factorTypes=new ArrayList<FactorType>();
		for(FactorScoreCardVO factorScoreCardVO:factorScoreCardVOs){
				FactorType f= new FactorType();
				FactorType.Banks banks= new FactorType.Banks();
				f.setFactorId(factorScoreCardVO.getFactorid());
				f.setFactorName(factorScoreCardVO.getFactorName());
				banks.getBank().addAll(getBankList(factorScoreCardVO.getBankScoreCards()));
				f.setBanks(banks);
				factorTypes.add(f);
		}
		return factorTypes;
	}
	private static List<BankType> getBankList(List<BankScoreCardVO> bankScoreCardVOs){
		List<BankType> bankTypes= new ArrayList<BankType>();
		int scoreMax=0;
		for(BankScoreCardVO bankScoreCardVO:bankScoreCardVOs){
			if(bankScoreCardVO.getScore()>scoreMax){
				scoreMax=bankScoreCardVO.getScore().intValue();
			}
		}
		for(BankScoreCardVO bankScoreCardVO:bankScoreCardVOs){
			BankType b= new BankType();
			b.setBankName(bankScoreCardVO.getBankname());
			b.setBankCode(bankScoreCardVO.getBankcode());
			b.setExpectedValue(bankScoreCardVO.getExpectedValue());
			b.setActualValue(bankScoreCardVO.getActualValue());
			b.setActualPercentage(new Integer(bankScoreCardVO.getScore().intValue()));
			if(scoreMax>100){
				b.setRelativePercentage(new Double(100.0*b.getActualPercentage()/scoreMax).intValue());
			}else{
				b.setRelativePercentage(b.getActualPercentage());
			}
			
			bankTypes.add(b);
		}
		return bankTypes;
	}
}
*/